#include "ConvertOpDialog.h"
#include "ui_ConvertOpDialog.h"

ConvertOpDialog::ConvertOpDialog(QWidget *parent, const ImageWindow *from) :
    QDialog(parent),
    ui(new Ui::ConvertOpDialog)
{
    ui->setupUi(this);
    init(from);
}

ConvertOpDialog::~ConvertOpDialog()
{
    delete ui;
}

void ConvertOpDialog::init(const ImageWindow *from){
    if(from->isStandard()){
        ui->possibilityConversion->setText(QString(tr("Conversion from Integer to Real")));
    }else if(from->isDouble()){
        ui->possibilityConversion->setText(QString(tr("Conversion from Real to Integer")));
        ui->groupBoxRound->setEnabled(true);
    }


}

int ConvertOpDialog::getRound(){
    if(ui->possibilityConversion->isChecked() == false){
        return -1;
    }else{
        if(ui->radioButtonOpRound->isChecked()) return ParamRep::ROUND;
        if(ui->radioButtonOpCeil->isChecked()) return ParamRep::CEIL;
        if(ui->radioButtonOpFloor->isChecked()) return ParamRep::FLOOR;
        if(ui->radioButtonOpTrunc->isChecked()) return ParamRep::TRUNC;
    }
}

bool ConvertOpDialog::getOp(){
    return ui->possibilityConversion->isChecked();
}












